package com.hzhk.happyrent.ui.adapter.viewpager;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.view.ViewGroup;

import com.hzhk.happyrent.R;
import com.hzhk.happyrent.utils.ListUtils;

import java.util.List;

/**
 * Created by soft_zzc on 2018/1/15.
 */

public class ModelPreOrderAdapter extends FragmentPagerAdapter {
    private FragmentManager fragmentManager;
    private FragmentTransaction mCurTransaction = null;
    private static int[] type=new int[]{R.string.message_pre,R.string.message_bill,R.string.message_rent};
    private List<Fragment> fragments;
    private Context context;
    public ModelPreOrderAdapter(FragmentManager fm, List<Fragment> fragments,Context context) {
        super(fm);
        this.fragmentManager = fm;
        this.fragments = fragments;
        this.context=context;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return context.getString(type[position]);
    }

    @Override
    public int getCount() {
        return !ListUtils.isEmpty(fragments) ? fragments.size() : 0;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
//        super.destroyItem(container, position, object);
    }
}

